package com.shop.daoImpl;

import java.util.Set;

import com.shop.dao.MerchantOrderDao;
import com.shop.entity.MerchantOrder;
import com.shop.entity.OrderGoodsList;
import com.shop.entity.OrderLogistics;

/**
 * 
 * <b>一句话描述该类<b>
 * <pre>
 * 根据本订单中商品中的外键商户编号我们可以得知该订单中的商户外键值
 * </pre>
 * @author 威 
 * <br>2018年1月4日 下午5:01:42 
 *
 */
public class MerchantOrderDaoImpl extends BaseDaoImpl<MerchantOrder> implements MerchantOrderDao {

	public MerchantOrderDaoImpl() {
		super(MerchantOrder.class) ;
		// TODO Auto-generated constructor stub
	}

	@Override
	public Set<OrderGoodsList> findOrderGoodsList(MerchantOrder m) {
		return m.getOrderGoodsLists() ;
	}

	@Override
	public boolean saveOrderGoodsList(MerchantOrder m, OrderGoodsList goods) {
		m.getOrderGoodsLists().add(goods) ;
		getSession().save(m) ;
		return true ;
	}

	@Override
	public OrderLogistics findOrderLogistics(MerchantOrder m) {
		// TODO Auto-generated method stub
		return m.getLogistics() ;
	}

	@Override
	public boolean saveOrderLogistics(MerchantOrder m, OrderLogistics logistics) {
		m.setLogistics(logistics) ;
		getSession().save(m) ;
		return true ;
	}

}
